<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: new_attributes_select.php 11 2013-09-21 11:43:11Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 11 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 11:43:11 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

defined('_VALID_XTC') or die('Direct Access to this location is not allowed.');
$adminImages = DIR_WS_CATALOG."lang/". $_SESSION['language'] ."/admin/images/buttons/";
?>
  <tr>
    <td class="pageHeading" colspan="3">
    	<table class="table_pageHeading" border="0" width="100%" cellspacing="0" cellpadding="0">
		<tr>
		 <td class="pageHeading">
		    <?php echo $pageTitle; ?>
		 </td>
		</tr>
		</table>
    </td>
  </tr>
  <tr>
  	<td class="main">
  		<?php echo draw_form('select_product', 'new_attributes.php').draw_hidden_field('action', 'edit'); ?>
  		<table width="100%" cellpadding="0" cellspacing="0">
  			<tr>
  				<td valign="top" width="50%">
  					<br /><strong><?php echo SELECT_PRODUCT ?><br /><br />
  					<select name="current_product_id">
						<?php
							$line = $db->db_query("SELECT
														*
													FROM
														".TABLE_PRODUCTS_DESCRIPTION."
													WHERE
														products_id LIKE '%'
													AND
														language_id = '".$_SESSION['languages_id']."'
													ORDER BY
														products_name ASC");

							if ($line->_numOfRows) {
								while (!$line->EOF) {
									$title = $line->fields['products_name'];
									$current_product_id = $line->fields['products_id'];

									echo '<option value="'.$current_product_id.'">'.$title;
									$line->MoveNext();
								}
							} else
								echo "Es wurden derzeit noch keine Produkte angelegt.";
						?>
					</select><br /><br />
					<?php echo button(BUTTON_EDIT); ?><br />
  				</td>
  				<td valign="top">
  					<br /><strong><?php echo SELECT_COPY ?><br /><br />
  					<SELECT name="copy_product_id">
					<?php
					  $copy = $db->db_query("SELECT
				  									pd.products_name,
				  									pd.products_id
				  								FROM
				  									".TABLE_PRODUCTS_DESCRIPTION." pd,
				  									".TABLE_PRODUCTS_ATTRIBUTES." pa
				  								WHERE
				  									pa.products_id = pd.products_id
				  								AND
				  									pd.products_id
				  								LIKE
				  									'%'
				  								AND
				  									pd.language_id = '".$_SESSION['languages_id']."'
				  								GROUP BY
				  									pd.products_id
				  								ORDER BY
				  									pd.products_name ASC");

					  if ($copy->_numOfRows) {
					      echo '<option value="0">nichts kopieren</option>';
					      while (!$copy->EOF) {
					          echo '<option value="'.$copy->fields['products_id'].'">'.$copy->fields['products_name'].'</option>';
					          $copy->MoveNext();
					      }
					  } else
					      echo 'No products to copy attributes from';
					  ?>
			  		</select><br /><br />
			  		<?php echo button(BUTTON_EDIT); ?>
  				</td>
  			</tr>
  		</table>
  		</form>
  	</td>
  </tr>